#ifndef SPEECH_H
#define SPEECH_H

#include <QObject>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QFile>
#include "http.h"
#include <QHostInfo>
class MainWindow;
class Speech:public QObject
{
    Q_OBJECT
public:
    Speech(MainWindow *parent = nullptr);
    int detectKey();
    QString speechIdentify(QString fileName);
    //    获取Access Token
    const QString baiduTokenUrl = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=%1&client_secret=%2&";
    QString client_id = NULL;
    QString client_secret = NULL;
    //    语音识别url
    const QString baiduSpeechUrl = "https://vop.baidu.com/server_api?dev_pid=1537&cuid=%1&token=%2";
private:
    QString getJsonValue(QByteArray ba,QString key);
    MainWindow *m_parent;
private slots:

signals:

};

#endif // SPEECH_H
